package com.lanou.lenanapp.beans;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

import org.json.JSONException;
import org.json.JSONObject;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by dllo on 15/10/28.
 */
public class Special {


    /**
     * aid : 541
     * aname : [2015-10-28] 每日美女欣赏
     * aicon : http://ww4.sinaimg.cn/thumbnail/005LAqUhjw1execn9gn4fj30gy0pejw7.jpg
     * adesc : 每天早上8点发布，打造高质量美女图片专辑
     * is_long : 1
     * update_time : 1445990400
     * likes : 66.56
     * series_id : null
     * series_name : null
     */

    private String aid;
    private String aname;
    private String aicon;
    private String adesc;
    private String is_long;
    private String update_time;
    private String likes;
    private Object series_id;
    private Object series_name;

    public static Special objectFromData(String str) {

        return new Gson().fromJson(str, Special.class);
    }

    public static Special objectFromData(String str, String key) {

        try {
            JSONObject jsonObject = new JSONObject(str);

            return new Gson().fromJson(jsonObject.getString(str), Special.class);
        } catch (JSONException e) {
            e.printStackTrace();
        }

        return null;
    }

    public static List<Special> arraySpecialFromData(String str) {

        Type listType = new TypeToken<ArrayList<Special>>() {
        }.getType();

        return new Gson().fromJson(str, listType);
    }

    public static List<Special> arraySpecialFromData(String str, String key) {

        try {
            JSONObject jsonObject = new JSONObject(str);
            Type listType = new TypeToken<ArrayList<Special>>() {
            }.getType();

            return new Gson().fromJson(jsonObject.getString(str), listType);

        } catch (JSONException e) {
            e.printStackTrace();
        }

        return new ArrayList();


    }

    public void setAid(String aid) {
        this.aid = aid;
    }

    public void setAname(String aname) {
        this.aname = aname;
    }

    public void setAicon(String aicon) {
        this.aicon = aicon;
    }

    public void setAdesc(String adesc) {
        this.adesc = adesc;
    }

    public void setIs_long(String is_long) {
        this.is_long = is_long;
    }

    public void setUpdate_time(String update_time) {
        this.update_time = update_time;
    }

    public void setLikes(String likes) {
        this.likes = likes;
    }

    public void setSeries_id(Object series_id) {
        this.series_id = series_id;
    }

    public void setSeries_name(Object series_name) {
        this.series_name = series_name;
    }

    public String getAid() {
        return aid;
    }

    public String getAname() {
        return aname;
    }

    public String getAicon() {
        return aicon;
    }

    public String getAdesc() {
        return adesc;
    }

    public String getIs_long() {
        return is_long;
    }

    public String getUpdate_time() {
        return update_time;
    }

    public String getLikes() {
        return likes;
    }

    public Object getSeries_id() {
        return series_id;
    }

    public Object getSeries_name() {
        return series_name;
    }
}
